<template>
  <div>
    <ZgEdit
      ref="dialog"
      :columns="columns"
      :formulas="formulas"
      :validUrl="validUrl"
      :saveUrl="saveUrl"
      :view="view"
      @ok="$emit('ok')"
    >
    </ZgEdit>
  </div>
</template>
<script>
export default {
  data() {
    return {
      view: {
        width: '30%',
        top: '5%',
        title: '新增账户'
      },
      columns: [
        { code: 'compName', name: '机构名称', isNeed: true, compType: '单行文本', defaultVal: '', span: 24 },
        {
          code: 'compCode',
          name: '金融机构',
          isNeed: true,
          compType: '下拉选择',
          defaultVal: '',
          span: 24,
          extra: { 下拉选项: [], placeholder: '请选择金融机构' }
        },
        {
          code: 'bankCode',
          name: '银行账号',
          isNeed: true,
          compType: '单行文本',
          defaultVal: '',
          span: 24
        },
        {
          code: 'accountType',
          name: '账户类型',
          isNeed: true,
          compType: '字典',
          defaultVal: '',
          extra: { 字典类型: 'accountType' },
          span: 24
        },
        {
          code: 'status',
          name: '状态',
          isNeed: true,
          compType: '开关',
          defaultVal: 0,
          span: 24
        }
      ],
      formulas: [],
      validUrl: '',
      saveUrl: ''
    }
  },
  methods: {
    open(json, pageType) {
      if (pageType === 'edit') {
        this.$refs.dialog.open()
        this.view.title = '编辑'
      } else {
        this.$refs.dialog.open()
        this.view.title = '新增'
      }
    }
  }
}
</script>

<style lang="scss" scoped></style>
